From 4c79e2591517acdc78a061da2a93412bb7d47c0e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Kristian=20H=C3=B8gsberg?= Date: Tue, 17 Jan 2012 12:30:52 -0500 Subject: [PATCH] wayland: Report middle and right buttons correctly The linux evdev button codes have right as 274 and left as 273. --- gdk/wayland/gdkdevice-wayland.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/gdk/wayland/gdkdevice-wayland.c b/gdk/wayland/gdkdevice-wayland.c index a749c72d29..cc79ebf846 100644 --- a/gdk/wayland/gdkdevice-wayland.c +++ b/gdk/wayland/gdkdevice-wayland.c @@ -378,6 +378,19 @@ input_handle_button(void *data, struct wl_input_device *input_device, GdkDisplayWayland *display = GDK_DISPLAY_WAYLAND (device->display); GdkEvent *event; uint32_t modifier; + int gdk_button; + + switch (button) { + case 273: + gdk_button = 3; + break; + case 274: + gdk_button = 2; + break; + default: + gdk_button = button - 271; + break; + } device->time = time; event = gdk_event_new (state ? GDK_BUTTON_PRESS : GDK_BUTTON_RELEASE); @@ -390,10 +403,10 @@ input_handle_button(void *data, struct wl_input_device *input_device, event->button.y_root = (gdouble) device->y; event->button.axes = NULL; event->button.state = device->modifiers; - event->button.button = button - 271; + event->button.button = gdk_button; gdk_event_set_screen (event, display->screen); - modifier = 1 << (8 + button - 272); + modifier = 1 << (8 + gdk_button - 1); if (state) device->modifiers |= modifier; else -- 2.30.2